public class Main {
    public static void main(String[] args) {
        int[] nums = {1,100000};
        System.out.println(radixSort(nums));
        System.out.println((50-11)/6+1);
    }
    public static int radixSort(int[] nums){
        if(nums.length<2) return 0;
        int max=nums[0];
        int n= nums.length;
        int exp =1;
        for(int i =0;i<n;i++){
            if(nums[i]>max) max=nums[i];
        }
        while(max>=exp){
            int[] cnt = new int[10];
            int[] buf = new int [n];
            for(int i=0;i<n;i++){
                int digit = (nums[i]/exp)%10;
                cnt[digit]++;
            }
            for(int i=1;i<10;i++){
                cnt[i]+=cnt[i-1];
            }
            for(int i=n-1;i>=0;i--){
                int digit = nums[i]/exp%10;
                buf[cnt[digit]-1]=nums[i];
                cnt[digit]--;
            }
            System.arraycopy(buf,0,nums,0,n);
            exp*=10;
        }
        int ret=0;
        for(int i=1;i<n;i++){
            ret=Math.max(ret,nums[i]-nums[i-1]);
        }
        return ret;
    }
}